home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / prog / pbc22b.zip / PBC$BAS.ZIP / REPLACST.BAS < prev    next >
BASIC Source File  |  1993-01-01  |  878b  |  25 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        PBClone  Copyright (c) 1990-1993  Thomas G. Hanlin III        |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7. SUB ReplaceString (St$, Old$, New$, Found%, ErrCode%)
  8.    Found% = 0
  9.    IF LEN(Old$) THEN
  10.       ErrCode% = 0
  11.       IF Old$ <> New$ THEN
  12.          tmp% = INSTR(St$, Old$)
  13.          IF tmp% THEN
  14.             DO
  15.                St$ = LEFT$(St$, tmp% - 1) + New$ + MID$(St$, tmp% + LEN(Old$))
  16.                tmp% = INSTR(tmp% + LEN(New$), St$, Old$)
  17.             LOOP WHILE tmp%
  18.             Found% = -1
  19.          END IF
  20.       END IF
  21.    ELSE
  22.       ErrCode% = -1
  23.    END IF
  24. END SUB
  25.